package cn.xyinping.hrm.doc;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @author 27266
 * @desrciption 创建ES的文档对象
 *  索引库的创建
    文档的映射
    存储到ES的数据封装
 * @date 2021/11/28
 */
@Document(indexName = "hrm",type = "course")
@Data
public class CourseDoc {
    // 标记文档Id
    @Id
    private Long id;
    // 课程名字，要分词，指定Ik分词器
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;
    // 适用人群
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String forUser;
    @Field(type = FieldType.Keyword)// 指定为不分词
    private String gradeName;

    private Long courseTypeId;
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String tenantName;
    @Field(type = FieldType.Keyword,index = false)// 指定为不分词
    private String pic;

    private Long tenantId;

    private Integer saleCount;

    private Integer viewCount;

    private Integer commentCount;

    private Date onlineTime;
    @Field(type = FieldType.Keyword)
    private String chargeName;

    private Float price;

    private Float priceOld;


}
